﻿using UnityEngine;
using ScFramework.Core;

[DisallowMultipleComponent]
[RequireComponent(typeof(Transform))]
public class STransform : SComponent
{
    [DynamicValueAtrribute]
    public Vector3 LocalPosition
    {
        get => transform.localPosition;
        set => transform.localPosition = value;
    }

    [DynamicValueAtrribute]
    public float LocalRotation {
        get => transform.localEulerAngles.z;
        set => transform.localEulerAngles = new Vector3(0, 0, value);
    }
    [DynamicValueAtrribute]

    public bool LocalIsFliped
    {
        get => transform.localScale.x<0;
        set {
            if (value)
            {
                transform.localScale = new Vector3(-1, 1, 1);
            }
            else
            {
                transform.localScale = new Vector3(1, 1, 1);
            }
      //      Debug.Log("set scale:"+value);
        }
        
    }
}
